package com.oh.database;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class PreferencesManager {

	private String PREFS_SYS="system_set";
	
	private SharedPreferences mSPSys;
	private Editor mSDSys;
	public String PREFS_IS_FIRST="is_first";
	public String PREFS_PASSWORD = "password";
	
	private static PreferencesManager instance;
	
	public static PreferencesManager getInstance(){
		if(instance == null)
			instance = new PreferencesManager();
		return instance;
	}
	
	private PreferencesManager(){
		
	}
	
	public void initPreferences(Context context){
		mSPSys = context.getSharedPreferences(PREFS_SYS, 0); 
		mSDSys = mSPSys.edit();
		
	}
	
	public void setISFirst(boolean first){
		mSDSys.putBoolean(PREFS_SYS, first);
		mSDSys.commit();
	}
	
	public boolean getISFirst(){
		return mSPSys.getBoolean(PREFS_SYS, true);
	}
	
	public void setPassword(){
		mSDSys.putString(PREFS_PASSWORD, "admin123");
		mSDSys.commit();
	}
	
	public void setPassword(String password){
		mSDSys.putString(PREFS_PASSWORD, password);
		mSDSys.commit();
	}
	public String getPassword(){
		return mSPSys.getString(PREFS_PASSWORD, "-1");
	}
	
	

}
